home *** CD-ROM | disk | FTP | other *** search
- on moveWindow
- global gStageCorner
- gStageCorner = point((the stage).rect.left, (the stage).rect.top)
- end
-
- on SpriteToSoundChannel spriteNumber
- return SpriteToBarSlot(spriteNumber)
- end
-
- on SpriteToBarSlot spriteNumber
- global gCharacterSprites
- barSlot = getOne(gCharacterSprites, spriteNumber)
- if (barSlot < 1) or (barSlot > count(gCharacterSprites)) then
- debugAlert("Invalid bar slot number" && barSlot)
- return 0
- else
- return barSlot
- end if
- end
-
- on glassSpriteToBarSlot spriteNumber
- global gBarGlassSprites
- barSlot = getOne(gBarGlassSprites, spriteNumber)
- if (barSlot < 1) or (barSlot > count(gBarGlassSprites)) then
- debugAlert("Invalid bar slot number" && barSlot)
- return 0
- else
- return barSlot
- end if
- end
-
- on testActiveCharacter
- global gCurrentIndex
- gCurrentIndex = 1
- updateDisplay()
- end
-
- on updateDisplay skip
- global gCurrentIndex
- hilite line gCurrentIndex of field "ActionDisplay"
- member("ListDisplay").text = string(currentActionSteps())
- end
-
- on testRandom n
- a = 0
- b = 0
- c = 0
- repeat with X = 1 to n
- z = randomFromWeightedList([6, 2, 2], [#a, #b, #c])
- case z of
- #a:
- a = a + 1
- #b:
- b = b + 1
- #c:
- c = c + 1
- end case
- end repeat
- put "a" && a
- put "b" && b
- put "c" && c
- end
-
- on placeCursor newLoc
- global gStageCorner
- gStageCorner = point((the stage).rect.left, (the stage).rect.top)
- newLoc = gStageCorner + newLoc
- baPlaceCursor(newLoc[1], newLoc[2])
- end
-
- on pourIntersection vesselSprite, bottleSprite, spoutLoc
- hotRect = vesselSprite.rect
- if bottleSprite = vesselSprite then
- return 0
- else
- if inside(spoutLoc, hotRect) then
- return 1
- else
- return 0
- end if
- end if
- end
-
- on sendCharacter message, inSound, activeOnly
- if activeOnly then
- activeSprite = getActiveCharacter()
- sendSprite(activeSprite, message, inSound)
- else
- sendAllSprites(message)
- end if
- end
-
- on getActiveCharacter
- global gBarTopManager
- if not objectp(gBarTopManager) then
- return 0
- else
- return barSlotToSprite(getActiveSlot(gBarTopManager))
- end if
- end
-
- on getActiveGlass
- if getActiveCharacter() = 0 then
- return 0
- else
- return patronToGlass(getActiveCharacter())
- end if
- end
-
- on patronToGlass patronSprite
- global gBarTopManager
- return barSlotToGlassSprite(gBarTopManager, SpriteToBarSlot(patronSprite))
- end
-
- on storeHelpPointerState
- global gObeyHelpPointerstate
- gObeyHelpPointerstate = 0
- end
-
- on restoreHelpPointerState
- global gObeyHelpPointerstate
- gObeyHelpPointerstate = 1
- end
-
- on toggleToolTips
- global gHelpPointer
- gHelpPointer = not gHelpPointer
- if not gHelpPointer then
- hideToolTip()
- end if
- end
-
- on goSoda
- replaceDraggingAnything()
- if inBonusMode() then
- if marker(0) = label("SodaGunBonus") then
- play done
- else
- play frame "SodaGunBonus"
- end if
- else
- if marker(0) = label("SodaGun") then
- returnToBar()
- else
- dismissToolTip(1)
- go("SodaGun")
- end if
- end if
- end
-
- on saveCursor newCursor
- global gOldCursor
- gColdCursor = the cursor of sprite 0
- if voidp(newCursor) then
- newCursor = resetCursor()
- end if
- if the cursor of sprite 0 <> newCursor then
- cursor(newCursor)
- end if
- end
-
- on recreateCursor
- global gColdCursor
- if the cursor of sprite 0 <> gColdCursor then
- cursor(gColdCursor)
- end if
- end
-
- on keyDown
- global gSodaGun, gMatrixMode, gBarTopManager, gQuickPlayMode, gCurrentItem, gDraggingBottle, gThrottleRate, gPourThrottleRate, gEvenPouring, gMuteAllSounds, gSpoonSprite, gIceSprite, gGameLevel, gRecoverLastIngredient, gFloatSprite, debug, gPearlyGates, gGameLevelStartTime, gUserQuitFlag, gGameSetup, gBonusStartTime
- case the key of
- "[":
- if authoring() or (debug = 1) then
- gGameLevelStartTime = gGameLevelStartTime + minutes(1)
- gBonusStartTime = gBonusStartTime + seconds(5)
- end if
- "{":
- if authoring() or (debug = 1) then
- gGameLevelStartTime = gGameLevelStartTime - minutes(1)
- gBonusStartTime = gBonusStartTime - seconds(5)
- end if
- end case
- case the key of
- 24:
- nothing()
- dontPassEvent()
- exit
- end case
- if charToNum(the key) = 11 then
- gMatrixMode = not gMatrixMode
- gFloatSprite.trails = gMatrixMode
- else
- if (charToNum(the key) = 26) and authoring() then
- returnToBar(#test)
- exit
- else
- if (the keyCode = 53) or (charToNum(the key) = 17) then
- quitSequence()
- exit
- end if
- end if
- end if
- case the key of
- "+", "=":
- volumeUp()
- "-", "_":
- volumeDown()
- "4", "5", "6", "7", "8", "9":
- volumeSet(integer(the key))
- "0":
- toggleMute()
- end case
- if inMenuMode() then
- if marker(0) = label("Main Menu") then
- case the key of
- "n", "g":
- go("new game")
- clickSound()
- "l":
- go("saved game")
- clickSound()
- "o":
- go("options")
- clickSound()
- "h", "?", "/":
- go("Help")
- clickSound()
- "s":
- go("High Scores")
- clickSound()
- "q", "e":
- quitTheProjector()
- "d", "p":
- sendSprite(132, #mouseUp)
- clickSound()
- "f":
- sendSprite(133, #mouseUp)
- clickSound()
- "c":
- go("Credits")
- clickSound()
- "x":
- if the shiftDown and the mouseDown then
- gGameLevel = 0
- startNextLEvel()
- returnToBar(#slotMachine)
- clickSound()
- end if
- "k":
- gMatrixMode = 1
- end case
- if the keyCode = 122 then
- go("Help")
- clickSound()
- end if
- end if
- exit
- end if
- if gPearlyGates or gUserQuitFlag then
- exit
- end if
- if the keyCode = 122 then
- toggleHelpWindow(gCurrentItem)
- end if
- if not inBonusMode() then
- Active = getActiveCharacter()
- end if
- case the key of
- "a":
- if not inBonusMode() then
- sendSprite(Active, #toughLove)
- end if
- "b":
- if the optionDown then
- grabThisIngredient(#brandy)
- else
- if the shiftDown then
- grabThisIngredient(#BITTERS)
- else
- if commandOrControlDown() then
- grabThisIngredient(#raspberry)
- else
- grabThisIngredient(#bourbon)
- end if
- end if
- end if
- "c":
- if the optionDown then
- grabThisIngredient(#cocoRum)
- else
- if the shiftDown then
- grabThisIngredient(#cachaca)
- else
- if commandOrControlDown() then
- grabThisIngredient(#champ)
- else
- sendSprite(gSodaGun, #mChangeSoda, the key, 1)
- end if
- end if
- end if
- "d":
- grabThisIngredient(#dryVermouth)
- "e":
- if modifierDown() then
- quitGame()
- else
- if not inBonusMode() then
- emptyGlasses(0, VOID, 1)
- end if
- end if
- "f":
- if not inBonusMode() then
- if the shiftDown and draggingBottleThang() then
- sendSprite(gDraggingBottle, #mFlip)
- else
- sendSprite(Active, #charm)
- end if
- end if
- "g":
- if the shiftDown then
- grabThisIngredient(#GIN)
- else
- if commandOrControlDown() then
- grabThisIngredient(#grapefruit)
- else
- if the optionDown then
- grabThisIngredient(#grenadine)
- else
- sendSprite(gSodaGun, #mChangeSoda, the key, 1)
- end if
- end if
- end if
- "h":
- if modifierDown() then
- toggleHelpWindow(gCurrentItem)
- else
- toggleToolTips()
- end if
- "?", "/":
- if not inBonusMode() then
- toggleHelpWindow(gCurrentItem)
- end if
- "i":
- if modifierDown() then
- if not inBonusMode() then
- sendSprite(Active, #card)
- end if
- else
- if draggingBottleThang() then
- if sprite(gDraggingBottle).pIngredient = #ice then
- replaceDraggingAnything()
- else
- grabThisIngredient(#ice)
- end if
- else
- grabThisIngredient(#ice)
- end if
- end if
- "j":
- goSoda()
- "k":
- if modifierDown() then
- gMatrixMode = not gMatrixMode
- else
- grabThisIngredient(#kahfee)
- end if
- "l":
- if the shiftDown then
- grabThisIngredient(#limeWedge)
- else
- if commandOrControlDown() then
- grabThisIngredient(#lemonWedge)
- else
- if the optionDown then
- grabThisIngredient(#limetwist)
- else
- sendSprite(gSodaGun, #mChangeSoda, the key, 1)
- end if
- end if
- end if
- "m":
- if the shiftDown then
- grabThisIngredient(#melonLiquer)
- else
- if the optionDown then
- grabThisIngredient(#mchino)
- else
- if commandOrControlDown() then
- grabThisIngredient(#milk)
- else
- if draggingSpoon() then
- replaceDraggingAnything()
- else
- replaceDraggingAnything()
- grabThisIngredient(#spoon)
- end if
- end if
- end if
- end if
- "n":
- if not inBonusMode() then
- if modifierDown() then
- if not newCharacterEnters(#Always) then
- alertBeep()
- end if
- else
- removeGarnish()
- end if
- end if
- "o":
- if the shiftDown or inBonusMode() then
- grabThisIngredient(#orange)
- else
- if commandOrControlDown() then
- grabThisIngredient(#orangeWedge)
- else
- if the optionDown then
- grabThisIngredient(#olive)
- else
- if not inBonusMode() then
- sendSprite(Active, #order)
- end if
- end if
- end if
- end if
- "p":
- if commandOrControlDown() or the optionDown then
- grabThisIngredient(#pschnap)
- else
- if the shiftDown then
- grabThisIngredient(#pineapple)
- else
- if not inBonusMode() then
- togglePourWindow()
- else
- grabThisIngredient(#pschnap)
- end if
- end if
- end if
- "q":
- gQuickPlayMode = not gQuickPlayMode
- "r":
- if modifierDown() or inBonusMode() then
- grabThisIngredient(#rum)
- else
- if not inBonusMode() then
- if Active then
- sendSprite(Active, #recipes)
- else
- toggleRecipeWindow("other", VOID, 0)
- end if
- end if
- end if
- "s":
- if the optionDown then
- grabThisIngredient(#soco)
- else
- if the shiftDown then
- grabThisIngredient(#scotch)
- else
- if commandOrControlDown() then
- if inBonusMode() then
- grabThisIngredient(#scotch)
- else
- sendSprite(Active, #serve)
- end if
- else
- sendSprite(gSodaGun, #mChangeSoda, the key, 1)
- end if
- end if
- end if
- "t":
- if the optionDown or the shiftDown then
- grabThisIngredient(#tequila)
- else
- if commandOrControlDown() then
- grabThisIngredient(#tripleSec)
- else
- sendSprite(gSodaGun, #mChangeSoda, the key, 1)
- end if
- end if
- "u":
- soundFX("urine_into_mglass_wice", 0, 0)
- "v":
- if the optionDown then
- grabThisIngredient(#dryVermouth)
- else
- if the shiftDown then
- grabThisIngredient(#sweetVermouth)
- else
- grabThisIngredient(#vodka)
- end if
- end if
- "w":
- if modifierDown() then
- grabThisIngredient(#whiskey)
- else
- sendSprite(gSodaGun, #mChangeSoda, the key, 1)
- end if
- "x":
- if modifierDown() then
- getAnXbottle()
- else
- sendSprite(gSodaGun, #mChangeSoda, the key, 1)
- end if
- "y":
- if not inBonusMode() then
- emptyGlasses(0, 1, 0)
- end if
- "z":
- if modifierDown() then
- grabThisIngredient(#salt)
- else
- grabThisIngredient(#SUGAR)
- end if
- "1", "2", "3":
- if not inBonusMode() then
- makePatronActive(integer(the key))
- end if
- TAB:
- if not inBonusMode() then
- makePatronActive(VOID, 1)
- end if
- RETURN:
- returnToBar()
- SPACE:
- repeat while keyPressed(SPACE)
- stopEvent()
- updateStage()
- end repeat
- wasDragging = draggingAnything()
- returnToBar()
- if not wasDragging then
- grabThisIngredient(gRecoverLastIngredient, VOID, the mouseLoc)
- end if
- "\", "|":
- if modifierDown() then
- gThrottleRate = min(20, gThrottleRate + 1)
- else
- gThrottleRate = max(1, gThrottleRate - 1)
- end if
- "`", "~":
- if modifierDown() then
- gPourThrottleRate = min(20, gPourThrottleRate + 1)
- else
- gPourThrottleRate = max(1, gPourThrottleRate - 1)
- end if
- "!":
- gEvenPouring = not gEvenPouring
- "]":
- if authoring() or (debug = 1) then
- gGameSetup[gGameLevel][#MINTIPS] = currentLevel(#MINTIPS) - currentLevel(#MAXFASTPERFECTTIP)
- end if
- "}":
- if authoring() or (debug = 1) then
- gGameSetup[gGameLevel][#MAXEARLYTIPS] = currentLevel(#MAXEARLYTIPS) - currentLevel(#MAXFASTPERFECTTIP)
- end if
- end case
- end
-
- on getAnXbottle newLiquor
- global gXbottlePopup
- returnToBar()
- xSprite = sprite(64)
- if voidp(newLiquor) then
- sendSprite(gXbottlePopup, #mShowPopup, xSprite, xSprite.pIngredient, the mouseLoc, newLiquor)
- else
- sendSprite(xSprite, #mUseXbottle, newLiquor)
- end if
- return xSprite.spriteNum
- end
-
- on getLiquorBottle newLiquor, justLooking, pickupLoc
- global gIngredients
- if not justLooking then
- returnToBar()
- end if
- if gIngredients[newLiquor][#Xbottle] then
- if not justLooking then
- getAnXbottle(newLiquor)
- end if
- return 0
- end if
- repeat with X = 32 to 37
- if locateIngredient(X, newLiquor, justLooking) then
- return X
- end if
- end repeat
- repeat with X = 41 to 47
- if locateIngredient(X, newLiquor, justLooking) then
- return X
- end if
- end repeat
- repeat with X = 56 to 75
- if locateIngredient(X, newLiquor, justLooking, pickupLoc) then
- return X
- end if
- end repeat
- return 0
- end
-
- on grabThisIngredient newIngredient, justLooking, pickupLoc
- global gSodaGun, gSpoonSprite, gIceSprite
- if not symbolp(newIngredient) then
- exit
- end if
- if isGarnish(newIngredient) then
- repeat with X = 32 to 37
- if locateIngredient(X, newIngredient, justLooking) then
- return X
- next repeat
- end if
- if locateIngredient(X, twistIt(newIngredient), justLooking) then
- return X
- end if
- end repeat
- else
- if isSodaIngredient(newIngredient) then
- if not justLooking then
- sendSprite(gSodaGun, #mChangeSoda, newIngredient, 1)
- end if
- return gSodaGun.spriteNum
- else
- if newIngredient = #spoon then
- sendSprite(gSpoonSprite, #mPickMeUp)
- return gSpoonSprite.spriteNum
- else
- if newIngredient = #ice then
- sendSprite(gIceSprite, #mPickMeUp)
- return gIceSprite.spriteNum
- else
- return getLiquorBottle(newIngredient, justLooking, pickupLoc)
- end if
- end if
- end if
- end if
- end
-
- on locateIngredient X, newIngredient, justLooking, pickupLoc
- if sprite(X).pIngredient = newIngredient then
- if not justLooking then
- sendSprite(X, #mPickMeUp, newIngredient, pickupLoc)
- end if
- return 1
- end if
- end
-
- on wait interval
- startAt = nowTicks()
- repeat while nowTicks() < (startAt + interval)
- end repeat
- end
-
- on monitor
- end
-
- on diagnose
- put sprite(getActiveCharacter()).pStepsInCurrentAction
- put sprite(getActiveCharacter()).pActionList
- end
-
- on gotoFlashFrame flashSprite, frameNum, updateMe
- gotoFrame(flashSprite, frameNum)
- if updateMe then
- updateStage()
- end if
- end
-
- on stageBox
- return rect(0, 0, (the stage).rect.width, (the stage).rect.height)
- end
-
- on goFlash flashSprite, start, end
- repeat while 1
- exit = 0
- repeat with X = start to end
- gotoFlashFrame(sprite(flashSprite), X, 1)
- if the mouseDown then
- exit = 1
- exit repeat
- end if
- end repeat
- if exit = 1 then
- exit repeat
- end if
- end repeat
- put X
- repeat while the stillDown
- updateStage()
- end repeat
- end
-